<?php
namespace app\admin\controller;


use app\admin\model\Message as MessageModel;
class Message extends BaseAdmin{
    private $model = "";
    public function _initialize(){
        parent::_initialize();
        $this->model = new MessageModel;
    }
    function index(){
        $list=db('message')->alias("a")->join("cases_type b","a.pid = b.ty_id")->order("id desc")->paginate(10);
        $this->assign("list",$list);
        $page=$list->render();
        $this->assign("page",$page);
        
       
        
        return view('index');
    }
    function look(){
        $id=input('id');
        $re=db('message')->where("id=$id")->find();
        echo json_encode($re);
    }
    public function delete(){
        $id=input('id');
        $del=$this->model->deleteMes($id);
        $this->redirect('index');
    }
    public function delete_all(){
        $id=input('id');
        $arr=explode(",", $id);
        $del=$this->model->deleteAll($arr);
        $this->redirect('index');
    }
}